﻿using Panuon.UI.Silver;
using ProjBobcat.Class.Helper;
using ProjBobcat.DefaultComponent.Launch;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using WaveringLand_Launcher.ViewModel;

namespace WaveringLand_Launcher
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    [PropertyChanged.AddINotifyPropertyChangedInterface]
    public partial class App : Application
    {
        public static string Version = "1.1.3";

        public static DefaultGameCore core;

        public static void SetView(UserControl view)
        {
            if (App.Current.MainWindow != null)
                (App.Current.MainWindow.DataContext as MainWindowViewModel).Control = view;


        }

        public static void ShowMessage(string content,string title = "")
        {
            MessageBoxX.Show(App.Current.MainWindow, content, title);
        }
        public App()
        {
            ServiceHelper.Init();
            HttpClientHelper.Init();

            var clientToken = Guid.NewGuid();
            var rootPath = ".minecraft";
            App.core = new DefaultGameCore
            {
                ClientToken = clientToken,
                RootPath = rootPath,
                VersionLocator = new DefaultVersionLocator(rootPath, clientToken)
                {
                    LauncherProfileParser = new DefaultLauncherProfileParser(rootPath, clientToken),
                    LauncherAccountParser = new DefaultLauncherAccountParser(rootPath,clientToken)
                },
                GameLogResolver = new ProjBobcat.DefaultComponent.Logging.DefaultGameLogResolver(),
            };
        }


    }
}
